package com.study.demo.controller;

import com.study.demo.dao.DogRepository;
import com.study.demo.service.DogService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Controller;

@Controller
public class DogController {
    public void hello(int i) {
        // 1.获取 Spring 容器
        ApplicationContext context =
                new ClassPathXmlApplicationContext("spring-config.xml");
        // 2.获取 Bean 对象
        DogService dogService = context.getBean("DogService",DogService.class);
        dogService.hello();
    }
}
